home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / BORLAND TURBO / SCRPTEXM.PAK / CRTL.SPP < prev    next >
Text File  |  1997-05-06  |  956b  |  34 lines

  1. //--------------------------------------------------------------------------
  2. // Object Scripting
  3. // Copyright (c) 1996, 1997 by Borland International, All Rights Reserved
  4. //
  5. // CRTL.SPP: Demonstrates script access to the C RTL by writing Albert's
  6. //   words to a file.
  7. //--------------------------------------------------------------------------
  8. print typeid(module());
  9.  
  10. //
  11. // Needed constants from stdio.h.
  12. //
  13. #define LPFILE long
  14.  
  15. //
  16. // Import RTL functions. Prototypes adopted from stdio.h.
  17. //
  18. import "cw3220.dll" {
  19.   int    fclose (LPFILE __stream);
  20.   int    fflush (LPFILE __stream);
  21.   LPFILE fopen  (const char * __path, const char * __mode);
  22.   int    fputs  (const char * __s, LPFILE __stream);
  23.   int    puts   (const char * __s);
  24. }
  25.  
  26. //
  27. // Write Albert's words to a file.
  28. //
  29. TestFile = fopen("testcrtl.txt", "w");
  30. fputs("\"How do I work? I grope.\" --Albert Einstein", TestFile);
  31. fflush(TestFile);
  32. fclose(TestFile);
  33.  
  34.